<div class="file-header">
    <div class="col-lg-12" style="padding-top: 15px;">

        <div class="btn-group">
            <button type="button" class="btn btn-primary" ng-hide="show_right"
                    ng-click="openUpload()" ng-disabled="disk.obj.used>=disk.obj.limit">
                <i class="fa fa-upload"></i><span class="hidden-xs"> 上传</span></button>
            <button type="button" class="btn btn-success"
                    ng-click="startAddFolder()"><i class="fa fa-plus"></i><span class="hidden-xs"> 新建文件夹</span></button>
        </div>
        <div style="display: inline-block;">
            <button type="button" class="btn btn-primary" ng-disabled="deletable()"
                    ng-if="dirType=='1'" ng-click="backup()">
                <i class="fa fa-compress"></i><span class="hidden-xs"> 批量备份</span>
            </button>
            <div class="btn-group" ng-show="!deletable()">
                <button type="button" class="btn btn-danger"
                        ng-disabled="deletable()" ng-click="delete()">
                    <i class="fa fa-times"></i><span class="hidden-xs"> 删除</span>
                </button>
                <button type="button" class="btn btn-warning"
                        ng-disabled="!rename_able()" ng-click="startRename()">
                    <i class="fa fa-edit"></i><span class="hidden-xs"> 重命名</span>
                </button>
                <button type="button" class="btn btn-primary"
                        ng-disabled="deletable()" ng-click="startMove()">
                    <i class="fa fa-cut"></i><span class="hidden-xs"> 剪切</span>
                </button>
                <button type="button" class="btn btn-primary"
                        ng-disabled="deletable()" ng-click="startCopy()">
                    <i class="fa fa-copy"></i><span class="hidden-xs"> 复制</span>
                </button>
            </div>
            <button type="button" class="btn btn-primary"
                    ng-show="cutBord" ng-click="paste()">
                <i class="fa fa-paste"></i><span class="hidden-xs"> 粘贴</span>
            </button>
        </div>
        <div class="input-group" style="padding-top: 10px;">
            <div class="form-group" style="width: 80px; float: left; margin-right: 5px; margin-bottom: 0;">
                <select class="form-control" ng-model="dirType" ng-change="dirTypeChange()">
                    <option value="0">全部</option>
                    <option value="1">视频</option>
                    <option value="2">图片</option>
                </select>
            </div>
            <input type="text" class="form-control" autocomplete="off" style="width: 190px;float: right;"
                   ng-model="searchName" id="search_file" placeholder="搜索文件">
            <span class="input-group-btn">
                <button class="btn btn-default" style="" ng-click="refresh()"><i class="fa fa-refresh"></i><span class="hidden-xs"> 刷新</span></button>
            </span>
        </div>
    </div>
    <div class="col-lg-12" style="padding: 10px 18px;">
        <span ng-if="dirs.length>1"><a href="javascript:" ng-click="opendir(dirs[dirs.length-2].dir)">返回上一级</a> | </span>
        <a href="javascript:" ng-click="opendir('_home')">全部文件</a>
        <span ng-repeat="x in dirs"> > <a href="javascript:" ng-click="opendir(x.dir)">{{x.name}}</a></span>
        <span style="float: right;">{{disk.used}} / {{disk.limit}}</span>

    </div>
    <div class="search-list " ng-show="searchName&&searchList.length">
        <ul class="list-group" style="margin: 0;width: 100%">
            <li class="list-group-item" ng-repeat="x in searchList"><a href="javascript:" ng-click="opendir(x.dir)"> {{x.name}}</a></li>
        </ul>
    </div>
</div>
<div class="col-lg-12 file-table" style="">
    <a href="" target="_self" id="download_deformation" style="display: none;"><span>test</span></a>
    <table class="table">
        <thead>
        <tr>
            <th style="width: 30px;"><input type="checkbox" ng-model="checkedAll" ng-change="checkAll()"/></th>
            <th ng-click="changeSort('name')">
                <a href="javascript:" style="color: black;">文件名&nbsp;</a>
                <i class="fa fa-sort-asc" ng-show="sortname=='name'&&sortorder=='asc'"></i>
                <i class="fa fa-sort-desc" ng-show="sortname=='name'&&sortorder=='desc'"></i>
            </th>
            <th class="hidden-xs" style="width: 20%;">大小&nbsp;</th>
            <th class="hidden-xs" ng-click="changeSort('ctime')" style="width: 30%;">
                <a href="javascript:" style="color: black;">修改时间&nbsp;</a>
                <i class="fa fa-sort-asc" ng-show="sortname=='ctime'&&sortorder=='asc'"></i>
                <i class="fa fa-sort-desc" ng-show="sortname=='ctime'&&sortorder=='desc'"></i>
            </th>
        </tr>
        </thead>
        <tbody>
        <tr style="display: none;" id="addFolderTr">
            <td><input type="checkbox"/></td>
            <td><i class="fa fa-folder"></i> <input type="text" ng-model="newFolderName" value=""/>
                <button ng-click="addNewFolder()"><i class="fa fa-check"></i></button>
                <button ng-click="cancelNewFolder()"><i class="fa fa-times"></i></button></td>
            <td>-</td><td>-</td>
        </tr>
        <tr ng-repeat="x in list" ng-mouseover="x.over=true;" ng-mouseleave="x.over=false;" ng-class="x._class">
            <td><input type="checkbox" ng-model="x.checked"/></td>
            <td ng-dblclick="openFile(x, $index)">
                <a href="javascript:" ng-click="x.checked=!x.checked;" style="color: black;" ng-hide="x.renaming">
                    <i ng-class="{'fa fa-folder': !x.size,'fa fa-file':x.size}"></i>
                    <span> {{x.subname || x.name}} </span>
                </a>
                <a href="javascript:" ng-click="openFile(x, $index)" style="float: right;margin: 0 15px;"
                   ng-show="!x.size&&x.checked&&!x.renaming">
                    <i class="fa fa-folder-open"></i>
                </a>
                <a href="javascript:" ng-click="download(x)" style="float: right;margin: 0 15px;"
                   ng-show="x.size&&x.checked&&!x.renaming">
                    <i class="fa fa-download"></i>
                </a>
                <a href="javascript:" ng-click="openFile(x, $index)" style="float: right;margin: 0 15px;"
                   ng-show="x.size&&x.checked&&!x.renaming">
                    <i class="fa fa-search"></i>
                </a>
                <div ng-show="x.renaming">
                    <i ng-class="{'fa fa-folder': !x.size,'fa fa-file':x.size}"></i>
                    <input ng-model="x.newName"/>
                    <button ng-click="rename(x)"><i class="fa fa-check"></i></button>
                    <button ng-click="x.renaming=false;"><i class="fa fa-times"></i></button>
                </div>
            </td>
            <td class="hidden-xs">{{x.size?x.size:'-'}}</td>
            <td class="hidden-xs">{{x.ctime | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
        </tr>
        </tbody>
    </table>
</div>

<div class="modal fade" tabindex="-1" role="dialog" id="file-upload">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">文件上传</h4>
            </div>
            <div class="modal-body">
                <div class="form" style="overflow: auto;">
                    <div class="form-group">
                        <buttom type="button" ng-click="select_files()" class="btn btn-warning btn-block">
                            选择上传文件</buttom>
                    </div>
                    <div class="form-group" ng-show="uploadFiles&&uploadFiles.length" >
                        <button type="button" ng-click="upload_files()" class="btn btn-block btn-success">
                            <i class="fa fa-cloud-upload"></i> 上传</button>
                    </div>
                    <form class="form-inline" id="upload-form" ng-show="false" method="post" action="/files/upload"
                          enctype="multipart/form-data">
                        <div class="form-group ">
                            <input type="file" id="select-image" name="image1" accept="*/*" required="required" multiple>
                        </div>
                    </form>
                    <h4 ng-show="uploadFiles&&uploadFiles.length">上传文件列表：</h4>
                    <ul class="list list-border" style="height: 214px;overflow: auto;">
                        <li ng-repeat="x in uploadFiles">{{x.name}}<br>大小{{x.size}}</li>
                    </ul>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" tabindex="-1" role="dialog" id="video-preview" >
    <div class="modal-dialog" role="document" style="width: 100%;margin: 0;height: 100%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" ng-click="pre.close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">视频浏览
                    <div class="btn-group">
                        <button class="btn btn-success " ng-click="download(pre)">
                            <i class="fa fa-download"></i> 下载</button>
                    </div>
                </h4>
            </div>
            <div class="modal-body">
                <div class="col-md-8 col-sm-12 preview-container">
                    <video controls="controls" id="priview-video" ng-if="pre.type == 'video'">
                        <source ng-src="{{pre.src}}" type="{{pre.srcType}}" style="background: #730000;">
                        您的浏览器不支持 video 标签。
                    </video>
                </div>
                <div class="col-md-4 col-sm-12">
                    <form class="form" name="transForm">
                        <div class="form-group">
                            <select class="form-control" ng-model="trans.size" required>
                                <option value="320" selected>320×？</option>
                                <option value="480">480×？</option>
                                <option value="720">720×？</option>
                                <option value="1080">1080×？</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <select class="form-control" ng-model="trans.aspect" required>
                                <option value="4:3">4:3</option>
                                <option value="16:9" selected>16:9</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>起点</label>
                            <div class="input-group">
                                <input type="number" class="form-control" ng-model="trans.start"/>
                                <span class="input-group-btn">
                                    <button class="btn btn-primary" ng-click="pre.setNowStart()">设置当前播放时间为起点</button>
                                </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>终点</label>
                            <div class="input-group">
                                <input type="number" class="form-control" ng-model="trans.end"/>
                                <span class="input-group-btn">
                                    <button class="btn btn-danger" ng-click="pre.setNowEnd()">设置当前播放时间为终点</button>
                                </span>
                            </div>
                        </div>
                        <button class="btn btn-success btn-block" ng-click="transcode([{name:pre.name,dir:dir}])"
                                ng-disabled="transForm.$invalid||trans.end<trans.start">
                            <i class="fa fa-refresh"></i> 转码</button>
                    </form>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" tabindex="-1" role="dialog" id="img-preview" >
    <div class="modal-dialog" role="document" style="width: 100%;margin: 0;height: 100%;">
        <div class="modal-content" style="background: #000;height: 100%; overflow: auto;;">
            <div class="modal-body preview-container">
                <button class="close" ng-click="download(pre)" style="float: left;color: white;opacity: 1;">
                    <i class="fa fa-download"></i></button>
                <button class="close" ng-click="opendir(pre.dir)" style="float: left;color: white;opacity: 1;margin-left: 15px;">
                    <i class="fa fa-file"></i></button>
                <button type="button" class="close" data-dismiss="modal" style="color: white;opacity: 1;"
                        ng-click="pre.close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <div class="preview-guide" ng-if="pre.type == 'img'">
                    <a href="javascript:void(0)" class="preivew-pre" ng-click="pre.go(-1)">
                        <i class="fa fa-angle-left fa-5x"></i>
                    </a>
                    <a href="javascript:void(0)" class="preivew-next" ng-click="pre.go(1)">
                        <i class="fa fa-angle-right fa-5x" style="float: right;"></i>
                    </a>
                </div>
                <img style="" ng-src="{{pre.src}}" ng-if="pre.type == 'img'">
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" tabindex="-1" role="dialog" id="torrent-download">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">{{bt.name}} - {{bt.total}}</h4>
            </div>
            <div class="modal-body" style="height: 500px;">
                <div class="col-md-6" style="height: 470px;overflow: auto;">
                    <form>
                        <div class="form-group">
                            <input type="text" ng-model="bt.name" class="form-control"/>
                        </div>
                        <div class="btn-group">
                            <button type="button" class="btn btn-success" ng-click="bt.download()">下载 <i class="fa fa-download"></i></button>
                        </div>
                    </form>
                    <h4>文件：</h4>
                    <div id="torrent-file-tree"></div>
                </div>
                <div class="col-md-6" style="height: 470px;overflow: auto;">
                    <div style="height: 30px;padding-left: 15px;margin: 5px 0;overflow: auto;">
                        <span>保存路径：{{bt.saveDir}}</span>
                        <button class="btn btn-default btn-sm" style="float: right;"
                                ng-hide="bt.saveDir=='/'" ng-click="bt.backToLast()">返回上一级</button>
                    </div>
                    <div id="my-direct-tree"></div>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->